//
//  CPGlobalColor.swift
//  cockpit
//
//  Created by Haijun Si on 2020/7/7.
//  Copyright © 2020 chenganrt. All rights reserved.
//

import UIKit

let CPColor_MainColor = UIColor(red: 47/255.0, green: 183/255.0, blue: 131/255.0, alpha: 1)
//let CPColor_MainColor = CPHEXColor(value: 0xf2f2f2)

let CPColor_GlobalBackColor = CPHEXColor(value: 0xf2f2f2)
let CPColor_lineColor = CPHEXColor(value: 0xdcdcdc)

let CPColor_White = UIColor.white


let CPColor333 = CPHEXColor(value: 0x333333)
let CPColor666 = CPHEXColor(value: 0x666666)
let CPColor999 = CPHEXColor(value: 0x999999)

func CPWhiteColor(white: CGFloat) -> UIColor {
    return UIColor.init(white: white/255.0, alpha: 1.0)
}

func CPRGBColor(red: CGFloat, green: CGFloat, blue: CGFloat ) -> UIColor {
    return  UIColor.init(red: red/255.0, green: green/255.0, blue: blue/255.0, alpha: 1.0)
}

///16进制色号 设置颜色 示例：UIColorHex(0x26A7E8)
func CPHEXColor(value:UInt32) -> UIColor{
    return CPHEXColor_A(value: value, alpha: 1.0)
}

func CPHEXColor_A(value:UInt32, alpha:CGFloat) -> UIColor{
     return UIColor(red: ((CGFloat)((value & 0xFF0000) >> 16)) / 255.0,
                green: ((CGFloat)((value & 0xFF00) >> 8)) / 255.0,
                blue: ((CGFloat)(value & 0xFF)) / 255.0,
                alpha: alpha)
}
